/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.etop.odbs.beans;

import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 查看文档的记录
 *
 * @author cjh
 */
@Entity
@Table(name = "chack")
public class Chack {

    private int id;
    private User user;          //查看文件的用户
    private Document document;  //被查看的文档
    private Date time;          //查看文档的日期
    private int isPraise;       //是否赞文档

    @Id
    @GeneratedValue
    public int getId() {
        return id;
    }

    @ManyToOne
    @JoinColumn(name = "uid")
    public User getUser() {
        return user;
    }

    @ManyToOne
    @JoinColumn(name = "did")
    public Document getDocument() {
        return document;
    }

    public Date getTime() {
        return time;
    }

    public int getIsPraise() {
        return isPraise;
    }

    public void setId(int id) {
        this.id = id;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public void setDocument(Document document) {
        this.document = document;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public void setIsPraise(int isPraise) {
        this.isPraise = isPraise;
    }

    @Override
    public String toString() {
        return "Comment{" + "id=" + id + ", user=" + user.getNickname() + ", document=" + document.getFilename() + '}';
    }

}
